package kr.hkit.powerjava.chapter22.programming;

import java.util.ArrayList;
import java.util.Collections;

public class Score {
	ArrayList<Double> scoreList = new ArrayList<Double>();

	public Score() {
		for (int i = 0; i < 10; i++) {
			scoreList.add(i, (int) (Math.random() * 100) / 10.0);
		}
	}

	@Override
	public String toString() {
		System.out.println("심사위원 점수");
		return String.format("%s", scoreList);
	}

	public void prnresult() {
		Collections.sort(scoreList);
		double sum = 0;
		for (int i = 1; i < 9; i++) {
			sum += scoreList.get(i);
		}
		System.out.printf("최고점 : %s, 최저점 : %s\n", scoreList.get(9),
				scoreList.get(0));
		System.out.printf("총점 : %s\n", sum);
	}

}
